﻿using WebAPI.Filters;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using wt.wine.Application.Common.Models;
using wt.wine.Application.ManageDevicerecordtalbe;
using wt.wine.Application.ManageDevicerecordtalbe.Command;
using wt.wine.Application.ManageDevicerecordtalbe.Queries;

namespace WebAPI.Controllers.V1
{
    /// <summary>
    /// 添加酒管理
    /// </summary>
    [ApiController]
    [Route("[controller]/[action]")]
    [LoginFilter]
    public class ManageDevicerecordtalbeController : ApiControllerBase
    {

        /// <summary>
        /// 添加酒
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [PermissioneFilter("AddDeviceRecord")]
        [HttpPost]
        public async Task<Json<string>> AddDeviceRecord([FromBody] AddDevicerecordCommand command)
        {
            return await Mediator.Send(command);
        }

        /// <summary>
        /// 【经销商】获取加酒列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [PermissioneFilter("GetDevicerecordList")]
        [HttpPost]
        public async Task<Json<PaginatedList<GetDevicerecordListDTO>>> GetDevicerecordList([FromBody] GetDevicerecordListQueries query)
        {
            return await Mediator.Send(query);
        }
    }
}
